package com.sushengren.easyword;

import com.sushengren.easyword.DemoData.ClassInfo;
import com.sushengren.easyword.DemoData.StudentInfo;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author sushengren
 */
public class Ber {

    public static void main(String[] args) throws IOException {

        List<StudentInfo> studentList = new ArrayList<>();
        studentList.add(new StudentInfo("小明", "No00001", 280.0, 93.3, 1, 1, ""));
        studentList.add(new StudentInfo("小红", "No00002", 260.0, 86.6, 2, 2, ""));
        studentList.add(new StudentInfo("小花", "No00003", 270.0, 90.0, 3, 120, ""));
        studentList.add(new StudentInfo("小莉", "No00004", 250.0, 83.3, 4, 210, ""));
        studentList.add(new StudentInfo("托尼", "No00005", 241.0, 80.3, 5, 600, ""));

        List<ClassInfo> classList = new ArrayList<>();
        classList.add(new ClassInfo("一年级一班", 50, 270.5, "一年级", 1, "温娟", studentList));
        classList.add(new ClassInfo("一年级二班", 60, 260.5, "一年级", 2, "张三", studentList));
        classList.add(new ClassInfo("一年级三班", 35, 280.5, "一年级", 3, "李四", studentList));
        classList.add(new ClassInfo("一年级四班", 56, 290.5, "一年级", 4, "王五", studentList));

        DemoData data = DemoData.builder()
                .title("2022年度期末考试成绩报告")
                .generationTime("2022-01-01")
                .numberOfStudents(1510)
                .numberOfInvigilators(157)
                .numberOfTeachers(157)
                .year("二零二二")
                .semester("第二学期")
                .examinationTime("2022-10-01 至 2022-10-02")
                .subject("语文、数学、英语")
                .classList(classList)
                .logo(new FileInputStream("C:\\Users\\mangfu\\Pictures\\logo.png"))
                .build();

        File file = new File("C:\\Users\\mangfu\\Desktop\\期末成绩报告模板.docx");
        FileOutputStream out = new FileOutputStream("C:\\Users\\mangfu\\Desktop\\期末成绩报告模板-1.docx");
        EasyWord.of(file).doWrite(data).toOutputStream(out);
    }

}
